<template>
  <div>
    <h2>添加</h2>
    <table>
      <tbody>
        <tr>
          <td>名称</td>
          <td><input type="text" v-model="form.name" /></td>
        </tr>
        <tr>
          <td>状态</td>
          <td><input type="text" v-model="form.zhuangtai" /></td>
        </tr>
        <tr>
          <td>详情</td>
          <td><input type="text" v-model="form.xingqing" /></td>
        </tr>
        <tr>
          <td></td>
          <td>
            <button class="bg bg-primary" @click="Add">添加</button>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import axios from "axios";
import { useRouter } from "vue-router";
import "bootstrap/dist/css/bootstrap.min.css";

const router = useRouter();
const form = reactive({
  id: 0,
  name: "",
  zhuangtai: "",
  xingqing: "",
});
const Add=()=>{
    axios.post("https://localhost:7189/api/quanyi/Addquan",form).then(res=>{
        if(res.data>0){
            alert("添加成功");
            router.push("/showquan")
        }
        else
        {
            alert("添加失败");
        }
    })
}

</script>

<style scoped></style>
